Ticker

6/recent/ticker-posts

Python subjective question for competitive exam (12)

Q1.Program to find mean of list of item.

import statistics l=[1,2,3,4,5] print(statistics.mean(l)) output >>> ================== RESTART: C:/Users/Dell/Desktop/statis.py ================== 3

Q2.Program to find median of list of values

import statistics l=[1,2,3,4,5] print(statistics.median(l)) output >>> ================== RESTART: C:/Users/Dell/Desktop/statis.py ================== 3



Q3.Program to find mode from list of values

import statistics a=[1,2,3,4,5,5,4,4] print(statistics.mode(a)) output >>> ================== RESTART: C:/Users/Dell/Desktop/statis.py ================== 4

Q4.Program to find standard derivation from list of values.

import statistics a=[1,2,3,4,5,5,4,4] print(statistics.stdev(a)) output >>> ================== RESTART: C:/Users/Dell/Desktop/statis.py ================== 1.4142135623730951

Q5 Program to find flatten list using nested for loop


l=[[1,2,3,4],[5,6,7,8]] result=[] for sublist in l: for element in sublist: result.append(element) print(result) output >>> ================== RESTART: C:/Users/Dell/Desktop/statis.py ================== [1, 2, 3, 4, 5, 6, 7, 8]



Post a Comment

0 Comments